package com.lehecai.core.api.openapi;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lehecai.core.IntegerBeanLabelItem;

/**
 * @author chirowong
 *
 */
public class OpenAPIAdsType extends IntegerBeanLabelItem {
	/**
	 * 
	 */
	private static final long serialVersionUID = -8593337496957110335L;

	private static final Logger logger = LoggerFactory.getLogger(OpenAPIAdsType.class.getName());
	
	private static List<OpenAPIAdsType> items = new ArrayList<OpenAPIAdsType>();
	
	protected OpenAPIAdsType(String name, int value) {
		super(OpenAPIAdsType.class.getName(), name, value);
		items.add(this);
	}
	
	public static OpenAPIAdsType getItem(int value){
		try {
			return (OpenAPIAdsType)OpenAPIAdsType.getResult(OpenAPIAdsType.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<OpenAPIAdsType> getItems() {
		return items;
	}

	public static final OpenAPIAdsType ALL = new OpenAPIAdsType("全部", 0);
	public static final OpenAPIAdsType OPENAPI_APP_ADS_TYPE_ADS = new OpenAPIAdsType("广告", 1);
	public static final OpenAPIAdsType OPENAPI_APP_ADS_TYPE_CONSULT = new OpenAPIAdsType("资讯", 2);
}